/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ManagerFrame.java
 *
 * Created on 2009-11-30, 11:13:47
 */
package View;

import Model.FlightsI;
import Model.AirportI;
import Control.FlightsServiceI;
import Control.AirportServiceI;
import java.util.ArrayList;
import javax.swing.JOptionPane;

/**
 *
 * @author Administrator
 */
public class ManagerFrame extends javax.swing.JFrame {

    FlightsServiceI csi;
    AirportServiceI csu;
    ArrayList list = null;
    private String user;


    public ManagerFrame() {
        super("Manager");
        initComponents();
        csi = new FlightsServiceI();
        csu = new AirportServiceI();
     
    }
    public ManagerFrame(String user) {
        super("Manager");
        initComponents();
        name_jlb.setText("Welcome,    " + user + "!");
        csi = new FlightsServiceI();
        csu = new AirportServiceI();
        this.user=user;
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        back_jbt = new javax.swing.JButton();
        logout_jbt = new javax.swing.JButton();
        planeid_jlb = new javax.swing.JLabel();
        sairport_jlb = new javax.swing.JLabel();
        gairport_jlb = new javax.swing.JLabel();
        stime_jlb = new javax.swing.JLabel();
        gtime_jlb = new javax.swing.JLabel();
        ticketprice_jlb = new javax.swing.JLabel();
        planeid_jtf = new javax.swing.JTextField();
        sairport_jtf = new javax.swing.JTextField();
        gairport_jtf = new javax.swing.JTextField();
        stime_jtf = new javax.swing.JTextField();
        gtime_jtf = new javax.swing.JTextField();
        ticketprice_jtf = new javax.swing.JTextField();
        CreateFlights_jlb = new javax.swing.JLabel();
        CreateFlights_jbt = new javax.swing.JButton();
        CreateAirport_jlb = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        airportName_jlb = new javax.swing.JLabel();
        airportTax_jlb = new javax.swing.JLabel();
        airportGSD_jlb = new javax.swing.JLabel();
        airportTel_jlb = new javax.swing.JLabel();
        airportName_jtf = new javax.swing.JTextField();
        airportTax_jtf = new javax.swing.JTextField();
        airportGSD_jtf = new javax.swing.JTextField();
        airportTel_jtf = new javax.swing.JTextField();
        CreateAirport_jbt = new javax.swing.JButton();
        ScanFlights_jlb = new javax.swing.JLabel();
        ScanFlights_jcb = new javax.swing.JComboBox();
        scan_jbt = new javax.swing.JButton();
        name_jlb = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        back_jbt.setBackground(new java.awt.Color(51, 51, 51));
        back_jbt.setForeground(new java.awt.Color(255, 255, 25));
        back_jbt.setText("Back");
        back_jbt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_jbtActionPerformed(evt);
            }
        });

        logout_jbt.setBackground(new java.awt.Color(51, 51, 51));
        logout_jbt.setForeground(new java.awt.Color(255, 255, 25));
        logout_jbt.setText("Logout");
        logout_jbt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logout_jbtActionPerformed(evt);
            }
        });

        planeid_jlb.setText("Plane_ID:");

        sairport_jlb.setText("Start_Airport:");

        gairport_jlb.setText("Get_Airport:");

        stime_jlb.setText("Start_Time:");

        gtime_jlb.setText("Get_Time:");

        ticketprice_jlb.setText("Ticket_Price:");

        planeid_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                planeid_jtfActionPerformed(evt);
            }
        });

        sairport_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sairport_jtfActionPerformed(evt);
            }
        });

        gairport_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gairport_jtfActionPerformed(evt);
            }
        });

        stime_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stime_jtfActionPerformed(evt);
            }
        });

        gtime_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gtime_jtfActionPerformed(evt);
            }
        });

        ticketprice_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ticketprice_jtfActionPerformed(evt);
            }
        });

        CreateFlights_jlb.setText("2.Manager can create your new flights in here:");

        CreateFlights_jbt.setBackground(new java.awt.Color(51, 51, 51));
        CreateFlights_jbt.setForeground(new java.awt.Color(255, 255, 25));
        CreateFlights_jbt.setText("Create");
        CreateFlights_jbt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CreateFlights_jbtActionPerformed(evt);
            }
        });
        CreateFlights_jbt.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                CreateFlights_jbtKeyPressed(evt);
            }
        });

        CreateAirport_jlb.setText("3.Manager can create your airport useful information for customers:");

        airportName_jlb.setText("Airport_Name:");

        airportTax_jlb.setText("Airport_Tax:");

        airportGSD_jlb.setText("Airport_GSD:");

        airportTel_jlb.setText("Airport_Tel:");

        airportName_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                airportName_jtfActionPerformed(evt);
            }
        });

        airportTax_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                airportTax_jtfActionPerformed(evt);
            }
        });

        airportGSD_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                airportGSD_jtfActionPerformed(evt);
            }
        });

        airportTel_jtf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                airportTel_jtfActionPerformed(evt);
            }
        });

        CreateAirport_jbt.setBackground(new java.awt.Color(51, 51, 51));
        CreateAirport_jbt.setForeground(new java.awt.Color(255, 255, 25));
        CreateAirport_jbt.setText("Create");
        CreateAirport_jbt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CreateAirport_jbtActionPerformed(evt);
            }
        });
        CreateAirport_jbt.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                CreateAirport_jbtKeyPressed(evt);
            }
        });

        ScanFlights_jlb.setText("1.Scan the flight selling data:");

        ScanFlights_jcb.setBackground(new java.awt.Color(102, 102, 0));
        ScanFlights_jcb.setEditable(true);
        ScanFlights_jcb.setForeground(new java.awt.Color(153, 153, 153));
        ScanFlights_jcb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Day", "Week", "Month" }));
        ScanFlights_jcb.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ScanFlights_jcbActionPerformed(evt);
            }
        });

        scan_jbt.setBackground(new java.awt.Color(51, 51, 51));
        scan_jbt.setForeground(new java.awt.Color(255, 255, 25));
        scan_jbt.setText("Scan");
        scan_jbt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                scan_jbtActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(92, 92, 92)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(planeid_jlb)
                                .addComponent(gtime_jlb)
                                .addComponent(stime_jlb)
                                .addComponent(gairport_jlb)
                                .addComponent(sairport_jlb)
                                .addComponent(ticketprice_jlb))
                            .addGap(40, 40, 40)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(ticketprice_jtf, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                                .addComponent(gtime_jtf, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                                .addComponent(planeid_jtf, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                                .addComponent(sairport_jtf, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                                .addComponent(gairport_jtf, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                                .addComponent(stime_jtf, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(CreateFlights_jbt))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(CreateFlights_jlb)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 139, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(CreateAirport_jlb)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(94, 94, 94)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(airportName_jlb)
                                    .addComponent(airportTax_jlb)
                                    .addComponent(airportTel_jlb)
                                    .addComponent(airportGSD_jlb))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(airportTax_jtf)
                                    .addComponent(airportGSD_jtf)
                                    .addComponent(airportName_jtf, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
                                    .addComponent(airportTel_jtf, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addGap(4, 4, 4)
                                .addComponent(CreateAirport_jbt)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(53, 53, 53)
                .addComponent(jLabel11)
                .addGap(79, 79, 79))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ScanFlights_jcb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(scan_jbt)
                .addContainerGap(393, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(back_jbt)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(name_jlb, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE))
                    .addComponent(ScanFlights_jlb, javax.swing.GroupLayout.Alignment.LEADING))
                .addGap(292, 292, 292)
                .addComponent(logout_jbt))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(back_jbt)
                    .addComponent(logout_jbt)
                    .addComponent(name_jlb, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(336, 336, 336)
                        .addComponent(jLabel11)
                        .addContainerGap(168, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(ScanFlights_jlb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ScanFlights_jcb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(scan_jbt))
                        .addGap(59, 59, 59)
                        .addComponent(CreateFlights_jlb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(planeid_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(sairport_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(gairport_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(planeid_jlb)
                                .addGap(18, 18, 18)
                                .addComponent(sairport_jlb)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(gairport_jlb)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(stime_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(stime_jlb))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(gtime_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(gtime_jlb))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ticketprice_jlb)
                            .addComponent(ticketprice_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CreateFlights_jbt))
                        .addGap(18, 18, 18)
                        .addComponent(CreateAirport_jlb)
                        .addGap(16, 16, 16)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(airportName_jlb)
                            .addComponent(airportName_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(airportTax_jlb)
                            .addComponent(airportTax_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(airportGSD_jlb)
                            .addComponent(airportGSD_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(airportTel_jlb)
                            .addComponent(CreateAirport_jbt)
                            .addComponent(airportTel_jtf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(43, 43, 43))))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void back_jbtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_jbtActionPerformed
        SuccessFrame su = new SuccessFrame(user);
        su.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_back_jbtActionPerformed

    private void sairport_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sairport_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_sairport_jtfActionPerformed

    private void logout_jbtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logout_jbtActionPerformed
        LoginFrame login = new LoginFrame();
        login.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_logout_jbtActionPerformed

    private void scan_jbtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scan_jbtActionPerformed
        ScanFrame scan = new ScanFrame(user);
        scan.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_scan_jbtActionPerformed

    private void CreateFlights_jbtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateFlights_jbtActionPerformed
        //Planeid is empty
        String planeid = planeid_jtf.getText();
        if (planeid.equals("")) {
            JOptionPane.showMessageDialog(null, "PlaneID don't empty,Please input PlaneID!");
            return;
        }
        FlightsI fi = new FlightsI();
        fi.setPlaneid(planeid);
        fi.setSairport(sairport_jtf.getText());
        fi.setGairport(gairport_jtf.getText());
        fi.setStime(stime_jtf.getText());
        fi.setGtime(gtime_jtf.getText());
        fi.setTicketprice(ticketprice_jtf.getText());

        csi.insertFlights(fi);
        JOptionPane.showMessageDialog(null, "Register Success");
        clearAllComponent();
    }//GEN-LAST:event_CreateFlights_jbtActionPerformed

    private void ScanFlights_jcbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ScanFlights_jcbActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ScanFlights_jcbActionPerformed

    private void planeid_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_planeid_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_planeid_jtfActionPerformed

    private void gairport_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gairport_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_gairport_jtfActionPerformed

    private void stime_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stime_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_stime_jtfActionPerformed

    private void gtime_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gtime_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_gtime_jtfActionPerformed

    private void ticketprice_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ticketprice_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ticketprice_jtfActionPerformed

    private void airportName_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_airportName_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_airportName_jtfActionPerformed

    private void airportTax_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_airportTax_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_airportTax_jtfActionPerformed

    private void airportGSD_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_airportGSD_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_airportGSD_jtfActionPerformed

    private void airportTel_jtfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_airportTel_jtfActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_airportTel_jtfActionPerformed

    private void CreateAirport_jbtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateAirport_jbtActionPerformed
        // TODO add your handling code here:
        //Planeid is empty
        String airportName = airportName_jtf.getText();
        if (airportName.equals("")) {
            JOptionPane.showMessageDialog(null, "AirportName don't empty,Please input AirportName!");
            return;
        }


        AirportI ai = new AirportI();
        ai.setAirportName(airportName);
        ai.setAirportTax(airportTax_jtf.getText());
        ai.setAirportGSD(airportGSD_jtf.getText());
        ai.setAirportTel(airportTel_jtf.getText());


        csu.insertAirport(ai);
        JOptionPane.showMessageDialog(null, "Register Success");
        clearAllComponent1();
        
    }//GEN-LAST:event_CreateAirport_jbtActionPerformed

    private void CreateFlights_jbtKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_CreateFlights_jbtKeyPressed
        // TODO add your handling code here:
        String planeid = planeid_jtf.getText();
        if (planeid.equals("")) {
            JOptionPane.showMessageDialog(null, "PlaneID don't empty,Please input PlaneID!");
            return;
        }
        FlightsI fi = new FlightsI();
        fi.setPlaneid(planeid);
        fi.setSairport(sairport_jtf.getText());
        fi.setGairport(gairport_jtf.getText());
        fi.setStime(stime_jtf.getText());
        fi.setGtime(gtime_jtf.getText());
        fi.setTicketprice(ticketprice_jtf.getText());

        csi.insertFlights(fi);
        JOptionPane.showMessageDialog(null, "Register Success");
        clearAllComponent();

    }//GEN-LAST:event_CreateFlights_jbtKeyPressed

    private void CreateAirport_jbtKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_CreateAirport_jbtKeyPressed
        // TODO add your handling code here:
        String airportName = airportName_jtf.getText();
        if (airportName.equals("")) {
            JOptionPane.showMessageDialog(null, "AirportName don't empty,Please input AirportName!");
            return;
        }


        AirportI ai = new AirportI();
        ai.setAirportName(airportName);
        ai.setAirportTax(airportTax_jtf.getText());
        ai.setAirportGSD(airportGSD_jtf.getText());
        ai.setAirportTel(airportTel_jtf.getText());


        csu.insertAirport(ai);
        JOptionPane.showMessageDialog(null, "Register Success");
        clearAllComponent1();
    }//GEN-LAST:event_CreateAirport_jbtKeyPressed
    public void clearAllComponent() {
        planeid_jtf.setText("");
        sairport_jtf.setText("");
        gairport_jtf.setText("");
        stime_jtf.setText("");
        gtime_jtf.setText("");
        ticketprice_jtf.setText("");
    }
    public void clearAllComponent1(){
        airportName_jtf.setText("");
        airportTax_jtf.setText("");
        airportGSD_jtf.setText("");
        airportTel_jtf.setText("");
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ManagerFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton CreateAirport_jbt;
    private javax.swing.JLabel CreateAirport_jlb;
    private javax.swing.JButton CreateFlights_jbt;
    private javax.swing.JLabel CreateFlights_jlb;
    private javax.swing.JComboBox ScanFlights_jcb;
    private javax.swing.JLabel ScanFlights_jlb;
    private javax.swing.JLabel airportGSD_jlb;
    private javax.swing.JTextField airportGSD_jtf;
    private javax.swing.JLabel airportName_jlb;
    private javax.swing.JTextField airportName_jtf;
    private javax.swing.JLabel airportTax_jlb;
    private javax.swing.JTextField airportTax_jtf;
    private javax.swing.JLabel airportTel_jlb;
    private javax.swing.JTextField airportTel_jtf;
    private javax.swing.JButton back_jbt;
    private javax.swing.JLabel gairport_jlb;
    private javax.swing.JTextField gairport_jtf;
    private javax.swing.JLabel gtime_jlb;
    private javax.swing.JTextField gtime_jtf;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JButton logout_jbt;
    private javax.swing.JLabel name_jlb;
    private javax.swing.JLabel planeid_jlb;
    private javax.swing.JTextField planeid_jtf;
    private javax.swing.JLabel sairport_jlb;
    private javax.swing.JTextField sairport_jtf;
    private javax.swing.JButton scan_jbt;
    private javax.swing.JLabel stime_jlb;
    private javax.swing.JTextField stime_jtf;
    private javax.swing.JLabel ticketprice_jlb;
    private javax.swing.JTextField ticketprice_jtf;
    // End of variables declaration//GEN-END:variables
}
